from pydantic import BaseModel
from functools import lru_cache
from os import path

class Config(BaseModel):
    # 系统根目录
    root_path: str = path.dirname(path.abspath(path.join(__file__, '..')))

    # 调试模式
    debug: bool = True

    # 项目信息
    version: str = "1.0.1"
    title: str = "签到系统"
    description: str = 'Web程序设计课程综合案例'

    #启动信息
    host: str = "0.0.0.0"
    port: int = 8088

    #数据库连接
    db_url: str = "mysql+pymysql://web2024:123123@127.0.0.1:3306/web2024?charset=utf8mb4"

@lru_cache
def get_config():
    return Config()
